# -*- coding: utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *


class MainForm(QMainWindow):
    """main window for file tree test"""
    def __init__(self, parent=None, server=None):
        """initializes main window and tree w/ splitter"""
        super(MainForm, self).__init__(parent)

        model_host = QFileSystemModel()
        model_host.setRootPath(QDir.homePath())
        if not server:
            model_server = QFileSystemModel()
            model_server.setRootPath(QDir.homePath())
        else:
            model_server = server

        self.view_host = QTreeView()
        self.setAnimated(True)
        self.view_host.setModel(model_host)
        self.view_server = QTreeView()
        self.view_server.setModel(model_server)

        self.sendButton = QPushButton("Download")

        self.treeSplitter = QSplitter(Qt.Horizontal)
        self.mainSplitter = QSplitter(Qt.Vertical)
        self.treeSplitter.addWidget(self.view_host)
        self.treeSplitter.addWidget(self.view_server)
        self.mainSplitter.addWidget(self.treeSplitter)
        self.mainSplitter.addWidget(self.sendButton)

        self.setCentralWidget(self.mainSplitter)

        self.resize(800, 480)


def main():
    """runs program"""
    app = QApplication(sys.argv)
    form = MainForm()
    form.show()
    app.exec_()

main()